<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>图片点击切换</title>
    <style>
    *{
        margin: 0;padding: 0;
     }
     img{
         width: 282px;
         height: 432px;
         position: relative;
         left: 10px;
         top: 10px;
     }
    </style>
</head>
<body>
    <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553698988175&di=a141d46e7774bcb56779f058ebcb4918&imgtype=0&src=http%3A%2F%2Fimg3.duitang.com%2Fuploads%2Fitem%2F201605%2F02%2F20160502190016_3GujB.jpeg" alt="">
<script>

let myImage = document.querySelector('img');
let imgOne = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553698988175&di=a141d46e7774bcb56779f058ebcb4918&imgtype=0&src=http%3A%2F%2Fimg3.duitang.com%2Fuploads%2Fitem%2F201605%2F02%2F20160502190016_3GujB.jpeg"
let imgTwo = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553698988175&di=76f721b9d0e571d158dea01122c46c7a&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201802%2F15%2F20180215102553_nWXXG.jpeg"
myImage.onclick = function () {
    let mySrc = myImage.getAttribute('src');
    if (mySrc === imgOne) {
        myImage.setAttribute('src',imgTwo);
    }
    else{
        myImage.setAttribute('src',imgOne);
    }
}
</script>
</body>
</html>